package pers.qianyu.month_202102.date_20210216;

import java.util.*;

/**
 * 561. 数组拆分 I
 * https://leetcode-cn.com/problems/array-partition-i/
 *
 * @author mizzle rain
 * @date 2021-02-16 20:33
 */
public class ArrayPairSum {
    public int arrayPairSum(int[] nums) {
        Arrays.sort(nums);
        int res = 0;
        for (int i = 0; i < nums.length; i += 2) {
            res += nums[i];
        }
        return res;
    }
}
